import java.util.Scanner;
import java.util.Stack;

public class Main3 {

    /*请在这里填写答案*/
    static boolean matching(String a, String b){
        Stack<Character> st = new Stack<Character>();
        int i = 0,j = 0;
        while(i<a.length()){
            st.push(a.charAt(i));
            i++;
            while(!st.empty()&&st.peek()==b.charAt(j)){
                st.pop();
                j++;
            }
        }
        return j==b.length();
    }

    public static void main(String[] args) {
        String a,b;
        Scanner sc = new Scanner(System.in);
        a = sc.next();
        b = sc.next();
        if (matching(a,b))
            System.out.println("yes");
        else
            System.out.println("no");
        sc.close();
    }
}